package com.jiaai.cloud.user.service.impl;

import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.jiaai.cloud.base.page.CustomPage;
import com.jiaai.cloud.user.entity.TUser;
import com.jiaai.cloud.user.mapper.TUserMapper;
import com.jiaai.cloud.user.service.ITUserService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.jiaai.cloud.user.vo.UserVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 佳爱网络科技
 * @since 2017-08-01
 */
@Service
public class TUserServiceImpl extends ServiceImpl<TUserMapper, TUser> implements ITUserService {

    @Override
    public TUser getUserByAnchorId(String anchorId) {
        return baseMapper.getUserByAnchorId(anchorId);
    }

    @Override
    public TUser getUserByBroadcastId(String anchorId) {
        return baseMapper.getUserByBroadcastId(anchorId);
    }

    @Override
    public UserVO findUserVOById(String userId) {
        return baseMapper.findUserVOById(userId);
    }

    /**
     * 根据用户消费记录
     * @param
     * @return
     */
    @Override
    public CustomPage findFully(Page page, @Param("ew") Wrapper wrapper) {
        page.setRecords(baseMapper.findFully(page,wrapper));
        return new CustomPage(page);
    }
    @Override
    public CustomPage findByall(Page page, @Param("ew") Wrapper wrapper) {
        page.setRecords(baseMapper.findByall(page,wrapper));
        return new CustomPage(page);
    }

    @Override
    public List<Map<String, Object>> selectUser() {
        return baseMapper.selectUser();
    }

    @Override
    public List<Map<String, Object>> allUser() {
        return baseMapper.allUser();
    }


    @Override
    public List<Map<String, Object>> selectMonthUser() {
        return baseMapper.selectMonthUser();
    }
}
